/**
 * There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
 */
package com.boxin.ims.modules.wechat.web.front;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.boxin.ims.modules.wechat.entity.Witticism;
import com.boxin.ims.modules.wechat.service.WitticismService;
import com.thinkgem.jeesite.common.config.Global;
import com.thinkgem.jeesite.common.web.BaseController;
import com.zhixun.mobile.extend.utils.PageVisitExtendUtils;

/**
 * 俏皮话Controller
 * @author Jakemanse
 * @version 2013-11-14
 */
@Controller
@RequestMapping(value = Global.FRONT_PATH+"/wechat/witticism")
public class WitticismFrontController extends BaseController {

	@Autowired
	private WitticismService witticismService;
	
	@ModelAttribute
	public Witticism get(@RequestParam(required=false) Long id) {
		if (id != null){
			return witticismService.get(id);
		}else{
			return new Witticism();
		}
	}
	

	@RequestMapping(value = "viewWitticism/{id}")
	public String form(@PathVariable Long id,HttpServletRequest request,Witticism witticism, Model model) {
		
		witticism=witticismService.get(id);
		
		//添加访问统计
		//存储访问记录
		//PageVisitExtendUtils.savePageVisit(request, witticism.getUser(), null, PageVisit.PAGE_TYPE_SIGNUP, null, "每日一签");
		
		model.addAttribute("witticism", witticism);
		return "modules/wechat/front/viewWitticism";
	}

	
}
